//
//  ADUnifiedNative.h
//  ADSDK
//
//  Created by 悦帅 on 2025/6/10.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class ADSDKError;
@protocol ADUnifiedNativeDelegate;
@class ADUnifiedNativeItem;

NS_ASSUME_NONNULL_BEGIN


@interface ADUnifiedNative : NSObject

/// 回调
@property (nonatomic, weak) id <ADUnifiedNativeDelegate>delegate;

/**
 初始化方法
 @param spaceID 广告位 ID
 @param spaceParam 广告位参数 可填写任意字符串
 @param lifeTime 给予广告请求时间 单位：秒，不小于3s
 @return 广告对象
 */
- (instancetype)initWithSpaceID:(NSString *)spaceID
                     spaceParam:(NSString *__nullable)spaceParam
                       lifeTime:(uint64_t)lifeTime;

/// 加载广告（主线程）
- (void)loadUnifiedNative;

/// 广告素材数据
@property (nonatomic, strong, readonly, nullable)ADUnifiedNativeItem *winItem;

/// 在winItem.adView被添加到父视图后调用
/// - Parameter containerView: 广告容器
- (void)registerContainerView:(UIView * _Nonnull)containerView;
@end


/**
 回调方法
 */
@protocol ADUnifiedNativeDelegate <NSObject>

@optional
/**
 广告请求成功
 */
- (void)unifiedNativeDidLoad:(ADUnifiedNative *)unifiedNative;

/**
 广告请求失败
 */
- (void)unifiedNative:(ADUnifiedNative *)unifiedNative didFailToLoadAdWithError:(ADSDKError *)error;

/**
 广告显示
 */
- (void)unifiedNativeDidShow:(ADUnifiedNative *)unifiedNative;

/**
 广告点击
 */
- (void)unifiedNativeDidClick:(ADUnifiedNative *)unifiedNative;

/**
 展示落地页
 */
- (void)unifiedNativeDidShowOtherController:(ADUnifiedNative *)unifiedNative;

/**
 关闭落地页
 */
- (void)unifiedNativeDidCloseOtherController:(ADUnifiedNative *)unifiedNative;


@end

NS_ASSUME_NONNULL_END
